package com.windward.vii.dao.mapper;

import com.windward.vii.dao.entity.AssetUserWithdraw;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AssetUserWithdrawMapper {
    @Delete({
        "delete from asset_user_withdraw",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into asset_user_withdraw (id, uid, org_id, ",
        "sn, amount, coin, ",
        "ip, create_time, ",
        "update_time, status, ",
        "audit_reason)",
        "values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT}, ",
        "#{sn,jdbcType=VARCHAR}, #{amount,jdbcType=INTEGER}, #{coin,jdbcType=INTEGER}, ",
        "#{ip,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT}, ",
        "#{auditReason,jdbcType=VARCHAR})"
    })
    int insert(AssetUserWithdraw record);

    int insertSelective(AssetUserWithdraw record);

    @Select({
        "select",
        "id, uid, org_id, sn, amount, coin, ip, create_time, update_time, status, audit_reason",
        "from asset_user_withdraw",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    AssetUserWithdraw selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AssetUserWithdraw record);

    @Update({
        "update asset_user_withdraw",
        "set uid = #{uid,jdbcType=BIGINT},",
          "org_id = #{orgId,jdbcType=BIGINT},",
          "sn = #{sn,jdbcType=VARCHAR},",
          "amount = #{amount,jdbcType=INTEGER},",
          "coin = #{coin,jdbcType=INTEGER},",
          "ip = #{ip,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "status = #{status,jdbcType=TINYINT},",
          "audit_reason = #{auditReason,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(AssetUserWithdraw record);
}